package com.zhou.jiancai.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Button;
import android.widget.TextView;

import com.zhou.jiancai.R;
import com.zhou.jiancai.base.BaseActivity;

import butterknife.ButterKnife;
import butterknife.InjectView;
import cn.bingoogolapple.bgabanner.BGABanner;

/**
 * Created by Administrator on 2017/4/21.
 */

public class GuideActivity extends BaseActivity {
    @InjectView(R.id.banner_guide_background)
    BGABanner bannerGuideBackground;
    @InjectView(R.id.banner_guide_foreground)
    BGABanner bannerGuideForeground;
    @InjectView(R.id.tv_guide_skip)
    TextView tvGuideSkip;
    @InjectView(R.id.btn_guide_enter)
    Button btnGuideEnter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      //  setContentView(R.layout.guide_activity);
        ButterKnife.inject(this);

        selListener();
        processLogic();
    }

    @Override
    protected void initdata() {

    }

    @Override
    protected void initview() {

    }

    @Override
    protected int getLayout() {
        return R.layout.guide_activity;
    }

    private void selListener() {
        bannerGuideForeground.setEnterSkipViewIdAndDelegate(R.id.btn_guide_enter,R.id.tv_guide_skip, new BGABanner.GuideDelegate() {
            @Override
            public void onClickEnterOrSkip() {
                //startActivity(new Intent(GuideActivity.this,SplashActivity.class));//因为有时候内存溢出
                startActivity(new Intent(GuideActivity.this,MainActivity.class));
                finish();
            }
        });

    }
    private void processLogic() {
        // 设置数据源
        bannerGuideBackground.setData(R.mipmap.uoko_guide_background_1, R.mipmap.uoko_guide_background_2, R.mipmap.uoko_guide_background_3);

        bannerGuideForeground.setData(R.mipmap.uoko_guide_foreground_1, R.mipmap.uoko_guide_foreground_2, R.mipmap.uoko_guide_foreground_3);
    }

    @Override
    protected void onResume() {
        super.onResume();
        // 如果开发者的引导页主题是透明的，需要在界面可见时给背景 Banner 设置一个白色背景，避免滑动过程中两个 Banner 都设置透明度后能看到 Launcher
        bannerGuideBackground.setBackgroundResource(android.R.color.white);
    }
}
